var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, i) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var i in e)
              Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
          })(e, i);
      };
      return function (e, i) {
        function n() {
          this.constructor = e;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        t(e, i),
          (e.prototype =
            null === i
              ? Object.create(i)
              : ((n.prototype = i.prototype), new n()));
      };
    })(),
  FactionCreateView = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        (e.resultArr = []),
        e.btn_fac_close.on(Laya.Event.CLICK, e, e.onDidClickClose),
        e.label_fac_type.on(Laya.Event.CLICK, e, e.onDataWithList),
        e.list_bangpai_select.on(Laya.Event.CLICK, e, e.onBangPaiDidSelected),
        (e.list_bangpai_select.selectEnable = !0),
        (e.list_bangpai_select.vScrollBarSkin = ""),
        e.btn_quedingchuangjian.on(
          Laya.Event.CLICK,
          e,
          e.onDidOKCreateBangPaiAction
        ),
        WebSocketService.addListener({
          caller: e,
          code: 1236,
          method: e.onLoadCreateBangPaiFn,
        }),
        e
      );
    }
    return (
      __extends(e, t),
      (e.openFactionView = function () {
        return (
          null == this.facView &&
            ((this.facView = new e()), (this.facView.zOrder = 1e3)),
          this.facView.popup(!0),
          (this.facView.list_bangpai_select.selectedIndex = 0),
          (this.facView.list_bangpai_select.visible = !1),
          this.facView
        );
      }),
      (e.prototype.onLoadCreateBangPaiFn = function (t) {
        0 == t.code
          ? (this.close(),
            ToastView.toastView("帮派创建成功"),
            WebSocketService.send({ c: 1126 }))
          : ToastView.toastView(t.msg);
      }),
      (e.prototype.onDataWithList = function () {
        var t = ["派", "教", "会", "帮", "楼", "阁", "军", "组", "社", "族"];
        this.resultArr = [];
        for (var e, i = 0; i < t.length; i++)
          (e = { item_bang: { text: i + 1 + "." + t[i] } }),
            this.resultArr.push(e);
        (this.list_bangpai_select.visible = !0),
          (this.list_bangpai_select.dataSource = this.resultArr);
      }),
      (e.prototype.onBangPaiDidSelected = function () {
        this.list_bangpai_select.visible = !1;
        var t = this.list_bangpai_select.selectedIndex,
          e = Dictionary.factionType[t + 1];
        this.label_faction.text = e;
      }),
      (e.prototype.onDidOKCreateBangPaiAction = function () {
        if (this.text_bangpai_name.text.length <= 0)
          ToastView.toastView("请输入帮派的名字");
        else if (this.text_faction_descr.text.length <= 0)
          ToastView.toastView("请输入帮派的宣言");
        else {
          var t = this.list_bangpai_select.selectedIndex + 1,
            e = this.text_bangpai_name.text,
            i = this.text_faction_descr.text;
          WebSocketService.send({ c: 1236, d: { type: t, name: e, desc: i } });
        }
      }),
      (e.prototype.onDidClickClose = function () {
        e.close();
      }),
      (e.close = function () {
        this.facView && (this.facView.close(), (this.facView = null));
      }),
      e
    );
  })(ui.FactionController.FactionCreateViewUI);
